from gui import gui

class application_window_fake :
    def __init__ ( self ) :
        self . _background = None
        self . _cget = { }
    def configure ( self , _fake_arg = None , background = None ) :
        self . _background = background
    def cget ( self , option ) :
        return self . _cget [ option ]

class tkinter_fake :
    def __init__ ( self ) :
        self . _application_windows = [ ]
    def Tk ( self ) :
        window = application_window_fake ( )
        self . _application_windows += [ window ]
        return window

class mediator_fake :
    def __init__ ( self ) :
        self . _gui_create_application_window_reply = None
    def gui_create_application_window_reply ( self , window ) :
        self . _gui_create_application_window_reply = window

class gui_background_color_tests :
    'gui_background_color'
    def __init__ ( self , test ) :
        self . _test = test
        self . _tkinter = tkinter_fake ( )
        self . _mediator = mediator_fake ( )
        self . _gui = gui ( mediator = self . _mediator , tkinter = self . _tkinter , tkfont = None , scheduler = None )
    def test_set_background_color ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        self . _gui . gui_set_background_color ( window , 'my color' )
        self . _test . assume_equal ( self . _tkinter . _application_windows [ 0 ] . _background , 'my color' )
    def test_push_background_color ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        self . _tkinter . _application_windows [ 0 ] . _cget [ 'background' ] = 'my background'
        self . _gui . gui_push_background_color ( window )
        self . _test . assume_equal ( self . _tkinter . _application_windows [ 0 ] . _background , None )
    def test_pop_background_color ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        self . _tkinter . _application_windows [ 0 ] . _cget [ 'background' ] = 'my background'
        self . _gui . gui_push_background_color ( window )
        del self . _tkinter . _application_windows [ 0 ] . _cget [ 'background' ]
        self . _gui . gui_pop_background_color ( window )
        self . _test . assume_equal ( self . _tkinter . _application_windows [ 0 ] . _background , 'my background' )
